import django_filters
from .models import *


class ItemFilter(django_filters.rest_framework.FilterSet):
    """过滤器"""

    id = django_filters.CharFilter()
    name = django_filters.CharFilter(lookup_expr='icontains')
    shop_name = django_filters.CharFilter(lookup_expr='icontains', field_name='shop__name')
    # minStock = django_filters.NumberFilter(field_name='item_sku__stock', help_text="最小库存", lookup_expr='gt')
    # maxStock = django_filters.NumberFilter(field_name='item_sku__stock', help_text="最大库存", lookup_expr='lt')
    
    class Meta:
        model = Item
        fields = '__all__'
